package com.none.PlayVideo;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import android.content.Intent;
import android.net.Uri;

public class  PlayVideo  extends CordovaPlugin{
	private CallbackContext callback;

	@Override
	public boolean execute(String action, JSONArray args,
			CallbackContext callbackContext) throws JSONException {


		this.callback=callbackContext;

		if(action.equals("presentMediaMp4")){
			playVideo();
		}
		return  true;
	}

	private void playVideo() {

		Intent it = new Intent(Intent.ACTION_VIEW);  
		Uri data = Uri.parse(
				"http://www.ydtsystem.com/CardImage/21/video/20140305/20140305124807_37734.mp4");
		it.setDataAndType(data, "video/*");
		cordova.getActivity().startActivity(it);	
	}


}
